import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from "path";

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  server:{
    host:'0.0.0.0'
  },
  resolve: {
    alias: {
      '@': path.resolve(__dirname, './src')
    }
  },
  build: {
    rollupOptions: {
      output: {
        // 确保worker文件被正确打包
        assetFileNames: (assetInfo) => {
          if (assetInfo.name.endsWith('.worker.js')) {
            return assetInfo.name;
          }
          return `${assetInfo.name}.${assetInfo.ext}`;
        },
      },
    },
  },
  css: {
    preprocessorOptions: {
      scss: {
        javascriptEnabled: true,
        // 此处不要忘记!!!!
        additionalData: '@import "src/assets/styles.scss";',
      },
    },
  },
})
